<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.meconsea.im.bean.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
	String contextPath = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>企业管理</title>
<link href="<%=contextPath%>/css/friend.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/css/css1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=contextPath%>/js/checkUtil.js"></script>
<script src="<%=contextPath%>/im/js/prototype.js" type="text/javascript"></script>
<script src="<%=contextPath%>/im/js/xhconn.js" type="text/javascript"></script>
<script src="<%=contextPath%>/im/js/json.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript"> 
function changeStyle(elementID,toStyle) {
  document.getElementById(elementID).className=toStyle;
 }
 var pingTo = "<%=contextPath%>/imEnterpriseService.do";
 var validateName = "0";
 function regIMEn(){
    var _enInfo = $("enterpriseInfo").value;
    if(_enInfo.realLength < 1 || _enInfo.realLeagth > 400){
    	alert("企业简介最多为200个汉字.");
    	return false;
    }
    if($("enterpriseTel").value.realLength < 1){
    	alert("企业电话不能为空.");
    	return false;
    }
    var _tel = $("enterpriseTel").value;
    if(!isTel(_tel) && !isMobil(_tel)){
    	alert("电话不符合规则.");
    	return false;
    }
    if($("enterpriseAddress").value.realLength < 1){
    	alert("企业地址不能为空.");
    	return false;
    }
    if($("enterpriseRelation").value.realLength < 1){
    	alert("企业联系人不能为空.");
    	return false;
    } 
    if($("enterpriseRealName").value.realLength < 1){
    	alert("企业名称不能为空.");
    	return false;
    } 
 	var regBtn = $("subReg");
 	regBtn.onclick = function (){};
    $("enterpriseIntro").value = $("enterpriseInfo").value+"verylady"+$("enterpriseRelation").value+"verylady"+$("enterpriseTel").value+"verylady"+$("enterpriseAddress").value;
	$("regForm").action="<%=contextPath%>/imEnterpriseService.do?action=regIME";
	$("regForm").submit();
 }
</script>
</head>
<%
	IMEnterprise ime = (IMEnterprise)request.getAttribute("imEn");
	if(ime == null){
		ime = new IMEnterprise();
	}
	String imeId = ime.getId();
	String imeName = ime.getEnterpriseName();
	String imeRName = ime.getEnterpriseRealName();
	String imeIntro = ime.getEnterpriseIntro();
	String[] info = imeIntro.split("verylady");
	String enterpriseInfo = info[0];
	String enterpriseRelation = info[1];
	String enterpriseTel = info[2];
	String enterpriseAddress = info[3];
	double creditLevel = ime.getCreditLevel();
	String clImg = "";
	for(int i = 1; i < creditLevel; i++){
		 clImg += "<img src ='"+contextPath+"/im/images/zz.gif' width=12px height=12px/>";
	}
	
%>
<body>
<div id="f_bg">
  <div id="f_tabs">
    <ul>
      <li id="tab1" class="f_tabClass1">企业信息</li>
      <li id="tab2" class="f_tabClass2"><a href="<%=contextPath%>/imEnterpriseService.do?action=list&enterpriseId=<%=imeId %>" >专家信息</a></li>
    </ul>
  </div>
</div>
<div id="f_main">
  <div id="friendlist">
  		<form action="<%=contextPath%>/imEnterpriseService.do?action=regIME" method="POST" name="regForm">
  		
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  	<td align='center'><span class="font1"><strong><%=imeRName %></strong>&nbsp;&nbsp;&nbsp;&nbsp;等级：<%=clImg %></span></td>
  </tr>
  <tr>
    <td><hr size="3" noshade style="color:#FCD4D2"></td>
  </tr>
</table>
<table width="750" border="0" align="center" cellpadding="8" cellspacing="0">
  
  <tr>
    <td colspan="3"><span class="font1"><strong>企业信息</strong></span>(带<span class="font2">*</span>的为必填项)
    </td>
  </tr>
  <tr>
    <td><div align="right">企业名称:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseRealName" value="<%=imeRName %>" class="input1" onfocus="changeStyle('nicknameMsg','msg2');" onblur="changeStyle('nicknameMsg','msg1');" size="30" maxlength="20"/>
    </td>
    <td><div class="msg1" id="nicknameMsg">3-20个字。</div></td>
  </tr> 
  <tr>
    <td><div align="right">密码:<span class="font2">*</span></div></td>
    <td>
      <input type="password" name="password" class="input1" onfocus="changeStyle('passwdMsg','msg2');" onblur="changeStyle('passwdMsg','msg1')" size="30" maxlength="20"/>
    </td>
    <td><div class="msg1" id="passwdMsg">密码由6-20个字符组成，为保证安全请使用英文字母加数字或符号的组合密码。<font style="font-size:12px;color:red">不填写代表不做修改</font></div></td>
  </tr>
  <tr>
    <td><div align="right">企业电话:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseTel" value="<%=enterpriseTel %>" class="input1"  size="30" maxlength="50"/>
    </td>
    <td><div class="msg1" id="questionMsg"></div></td>
  </tr>
  <tr>
    <td><div align="right">企业地址:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseAddress" value="<%=enterpriseAddress %>" class="input1"  size="30" maxlength="50"/>
    </td>
    <td><div class="msg1" id="answerMsg"></div></td>
  </tr>
  <tr>
    <td><div align="right">企业联系人:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseRelation" value="<%=enterpriseRelation %>" class="input1" size="30" maxlength="50"/>
    </td>
    <td><div class="msg1" id="answerMsg"></div></td>
  </tr>
    <td><div align="right">企业简介:<span class="font2">*</span></div></td>
    <td>
      <textarea name="enterpriseInfo" class="input1" style="width:210px;height:100px;"><%=enterpriseInfo %></textarea>
    </td>
    <td><div class="msg1" id="answerMsg"></div></td>
  </tr>
  <tr>
    <td><input type="hidden" name="enterpriseIntro">&nbsp;</td>
    <td><input type="hidden" name="enterpriseId" value="<%=imeId %>"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3"><div align="center">
      <input type="button" id="subReg" name="subReg" value="提交信息" style="button1" onclick="regIMEn()">
    </div></td>
    </tr> 
</table>
</form>
  </div>
  <div id="addfriend">  </div>
</div>
</body>
</html>